package nml.mail.reg.await;
import nml.mail.reg.Reg;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.support.ui.ExpectedCondition;
import org.openqa.selenium.support.ui.WebDriverWait;

public class mails_in extends Reg {

	public void reg(String username, String password) {
		

		String url = "http://mails.in/";
		get(url);

		dr.findElement(By.id("bottomlink")).click();
		sleep(2000);

		dr.findElement(By.name("realname")).sendKeys("Red");
		dr.findElement(By.name("username")).sendKeys(username);

		dr.findElement(By.id("next")).click();
		sleep(2000);

		dr.findElement(By.name("password")).sendKeys(password);
		dr.findElement(By.name("password_repeat")).sendKeys(password);

		
		
		dr.findElement(By.name("question")).sendKeys("where is my pan");
		dr.findElement(By.name("answer")).sendKeys("i donet no");
		dr.findElement(By.name("answer_repeat")).sendKeys("i donet no");

		dr.findElement(By.id("next")).click();
		sleep(2000);
		
		dr.findElement(By.id("next")).click();
		sleep(2000);
		
		 
		
		dr.findElement(By.id("next")).click();
		sleep(2000);
		
		
		WebDriverWait wait = new WebDriverWait(dr,10000000);
		wait.until(new ExpectedCondition<WebElement>() {
			@Override
			public WebElement apply(WebDriver d) {
				return d.findElement(By.name("recaptcha_response_field"));
			}
		}).click();
 
		
		
		
	}

	public static void main(String[] args) {
		new mails_in().reg("qq331798654", "qq3131798654");
	}

}
